package com.example.lenovo.qm;

import android.graphics.Color;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import androidx.appcompat.app.AppCompatActivity;

public class First extends AppCompatActivity {
    private LinearLayout ll;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_first);
        ll = findViewById(R.id.ll);
        addViews();
    }

    private void addViews() {
        LinearLayout view1 = new LinearLayout(this);
        LinearLayout view2 = new LinearLayout(this);
        view1.setBackgroundColor(Color.parseColor("#ADFF2F"));
        view2.setBackgroundColor(Color.parseColor("#DA70D6"));
        view1.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.MATCH_PARENT, 1));
        view2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.MATCH_PARENT, 2));
        ll.addView(view1);
        ll.addView(view2);


    }


}